<!DOCTYPE HTML>
<html>
<head>
	<title>Home</title>
	<link href="/css/style.css" rel="stylesheet" type="text/css" media="all" />
	<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="/css/orderInfo.css" />
	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<script src="/js/jquery-1.10.2.js"></script>

	<script type="text/javascript">
		$(function(){
			getUser();
			$("#takeSubmit").click(function(){
				var orderId=$("#orderId").val();
				var account=$("#account").val();
				if(orderId==null||account==null){
					alert("请输入订单号和对应的手机号");
					return;
				}
				else{
					
					$.ajax({
						url:"/order/takeTicket",
						type:"POST",
						data:{
							orderId:orderId,
							account:account
						},
						success:function(result){
							if(result.code==20000){
								$("#contentInfo").attr("style",'display: none');
								$("#resultInfo").attr("style","")
							}else{
								alert(result.data);
							}
						}
					});
				}
			});
		});
		function getUser() {
			$.ajax({
				url:"user/getUser",
				type:"get",
				success:function(data){
					if(data!=""){
						$("#userLogin").css("display","none");
						$("#userMessage").css("display","block");
						var content = '<a href="info.html">'
							+'<img alt="" src="'+data.uimg+'" height="40px" style="border-radius: 50%;">&nbsp'
							+'<span style="color:black;" id="uname">'+data.uname+'</span>&nbsp&nbsp'
							+'</a>'
							+'<button type="button" class="btn btn-info" onclick="logout()" style="">注销</button>';
						$("#userMessage").html(content);
					}else{
						$("#userLogin").css("display","block");
						$("#userMessage").css("display","none");
					}
				}
			});
		}
		function logout(){
			$.ajax({
				url:"user/logout",
				type:"get",
				success:function(data){
					getUser();
				}
			});
		}
	</script>
</head>
<body>
	<!-- header -->
	<div class="header">
		<div class="top_bg">
			<div class="container">
				<div class="header_top">
					<div class="logo">
						<a href="index.html" style="font-size: 20px;"><img src="/img/logo.png" alt="" />蜗牛影院</a>
					</div>
					<div class="top_right" style="margin-top: 0">
						<div id="userMessage" style="line-height: 45px;display: none;">
								<!-- <a href="info.html"><img alt="" src="images/aimg.jpg" height="40px" style="border-radius: 50%;" id="uimg">&nbsp<span style="color:black;" id="uname">1823342352323</span></a> -->
							</div>
							<ul id="userLogin" style="line-height: 45px;display: none;">
							<li><a href="registration.html">注册</a></li>|
							<li class="login">
								<div id="loginContainer"><a href="#" id="loginButton"><span>登陆</span></a>
									<div id="loginBox">
										<form id="loginForm">
											<fieldset id="body">
												<fieldset>
													<label for="email">账号</label>
													<input type="text" name="email" id="email">
												</fieldset>
												<fieldset>
													<label for="password">密码</label>
													<input type="password" name="password" id="password">
												</fieldset>
												<input type="submit" id="login" value="登陆">
												<label for="checkbox"><input type="checkbox" id="checkbox"> <i>记住我</i></label>
											</fieldset>
											<span><a href="#">密码忘记了?</a></span>
										</form>
									</div>
								</div>
							</li>
						</ul>
					</div>
					<div class="clearfix"> </div>
				</div>
			</div>
		</div>
	</div>
	<div class="head-bann">
		<div class="container">
			<div class="head-nav">
				<span class="menu"> </span>
				<ul class="megamenu skyblue">
					<li><a class="color1" href="index.html">首页</a></li>
						<li class="grid"><a class="color2" href="movies.html">影片</a></li>
						<li><a class="color4" href="cinema.html?mid=1">影院</a></li>
						<li><a class="color5" href="comment.html">评论</a></li>
					<div class="clearfix"> </div>
				</ul>
			</div>
		</div>
	</div>
	<!-- script-for-nav -->
	<script>
		$("span.menu").click(function() {
			$(".head-nav ul").slideToggle(300, function() {
				// Animation complete.
			});
		});
	</script>
	<!-- script-for-nav -->
	<!-- header -->
	<div class="container">
		<div class="col-md-12 ">
			<div class="order-progress-bar">
				<div class="progress" style="height:2px">
					<div class="progress-bar " role="progressbar" style="width: 100%; ">
					</div>
				</div>
				<div class="step first done">
					<span class="step-num">1</span>
					<!-- <div class="bar"></div> -->
					<span class="step-text">选择座位</span>
				</div>
				<div class="step done">
					<span class="step-num">2</span>
					<!-- <div class="bar"></div> -->
					<span class="step-text">确认订单</span>
				</div>
				<div class="step last ">
					<span class="step-num">3</span>
					<!-- <div class="bar"></div> -->
					<span class="step-text">取票观影</span>
				</div>
			</div>
		</div>
	</div>
	<!-- <div class="container waitInfo " >
		<div class="row clearfix">
			<div class="col-md-12 column">
				<div class="alert alert-dismissable alert-success">
					<h4>
						<strong>请稍后</strong>
					</h4>  正在为您查询支付结果... 
				</div>
			</div>
		</div>
	</div> -->
	<div class="container waitInfo">
		<div class="row clearfix">
			<div class="col-md-3 column">
			</div>
			<div class="col-md-6 column" id="contentInfo">
		
					<div class="col-md-12 column col-sm-offset-4">
						<h3>
							取票观影
						</h3>
					</div>
					<div class="form-group">
						<label for="orderId">请输入订单号</label><input type="text" class="form-control" id="orderId" name="orderId"/>
					</div>
					<div class="form-group">
						<label for="account">请输入账号</label><input type="text" class="form-control" id="account" name="account"/>
					</div>
					<div class="col-sm-offset-5"><button type="submit" id="takeSubmit" class="btn btn-default">取票</button></div>
			
			</div>
			<div class="col-md-6 column col-sm-offset-5" id="resultInfo" style="display: none">
				<h3>
				取票成功
				</h3>
			</div>
			<div class="col-md-3 column">
			</div>
		</div>
	</div>
	<!-- <iframe id="id_iframe" name="nm_iframe" style="display:none;"></iframe> -->


	<!-- footer -->
	<div class="footer">
		<div class="container">
			<p>Copyright &copy; 2015.Company name All rights reserved.</p>
		</div>
	</div>
	<!-- footer -->

</body>
</html>
